using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class SpecialtyTypeAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public SpecialtyTypeAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"ALC","AMB","CAN","CAR","CCR","CHI","EDI","EMR","FPC","INT","ISO","NAT","NBI","OBG","OBS","OTH","PED","PHY","PIN","PPS","PRE","PSI","PSY","REH","SUR","WIC"};
						validVersionCodes[HL7Version.v231] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
						validVersionCodes[HL7Version.v24] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
						validVersionCodes[HL7Version.v25] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
						validVersionCodes[HL7Version.v251] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
						validVersionCodes[HL7Version.v26] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
						validVersionCodes[HL7Version.v27] = new string[]{"AMB","PSY","PPS","REH","PRE","ISO","OBG","PIN","INT","SUR","PSI","EDI","CAR","NBI","CCR","PED","EMR","OBS","WIC","PHY","ALC","FPC","CHI","CAN","NAT","OTH"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Allergy","Ambulatory","Cancer","Coronary/Cardiac Care","Critical Care","Chiropractic","Education","Emergency","Family Planning","Intensive Care","Isolation","Naturopathic","Newborn, Nursery, Infants","Obstetrics, Gynecology","Observation","Other Specialty","Pediatrics","General/Family Practice","Pediatric/Neonatal Intensive Care","Pediatric Psychiatric","Pediatric Rehabilitation","Psychiatric Intensive Care","Psychiatric","Rehabilitation","Surgery","Walk-In Clinic"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Ambulatory","Psychiatric","Pediatric psychiatric","Rehabilitation","Pediatric rehabilitation","Isolation","Obstetrics, gynecology","Pediatric/neonatal intensive care","Intensive care","Surgery","Psychiatric intensive care","Education","Coronary/cardiac care","Newborn, nursery, infants","Critical care","Pediatrics","Emergency","Observation","Walk-in clinic","General/family practice","Allergy","Family planning","Chiropractic","Cancer","Naturopathic","Other specialty"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
